//
//  ZZNewCustomerDetailVCViewController.m
//  新项目
//
//  Created by liGordon on 17/3/15.
//  Copyright © 2017年 刘耀宗. All rights reserved.
//

#import "ZZNewCustomerDetailVCViewController.h"
#import "ZZNewCustomerDetailCell.h"
#import "ZZNewCustomerContentModel.h"
static NSString * identifier = @"NewCustomerDetailCell";
@interface ZZNewCustomerDetailVCViewController ()<UITableViewDelegate,UITableViewDataSource>
@property (strong, nonatomic) IBOutlet UITableView *menuTable;

@property (nonatomic ,strong)ZZNewCustomerContentModel *detailModel;

@end

@implementation ZZNewCustomerDetailVCViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    _menuTable.delegate = self;
    _menuTable.dataSource = self;
    self.title = @"新增客户分析";
    [_menuTable registerNib:[UINib nibWithNibName:@"ZZNewCustomerDetailCell" bundle:nil]forCellReuseIdentifier:identifier];
    _menuTable.separatorStyle = UITableViewCellSeparatorStyleNone;
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 11;
}

-(void)setModel:(ZZNewCustomerContentModel *)model
{
    _model = model;
    self.detailModel = model;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    ZZNewCustomerDetailCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier];
    cell.model = self.model;
    if (indexPath.row == 0) {
        cell.titleName.text = @"车牌号";
        if([self.detailModel.PlateNumber length]<=0){
            cell.detailName.text = @"暂无车牌号";
            
        }else{
            cell.detailName.text = self.detailModel.PlateNumber;
            
        }
    }else if (indexPath.row == 1){
        cell.titleName.text = @"车主姓名";
        
        if([self.detailModel.CarOwner length]<=0){
            
            cell.detailName.text = @"暂无车主姓名";
            
        }else{
            cell.detailName.text = self.detailModel.CarOwner;
            
        }
        
    }else if (indexPath.row == 2){
        cell.titleName.text = @"车辆品牌";
        
        
        if([self.detailModel.MakeName length]<=0){
            
            cell.detailName.text = @"暂无车辆品牌";
            
        }else{
            
            cell.detailName.text = self.detailModel.MakeName;
            
        }
        
        
        
    }else if (indexPath.row == 3){
        cell.titleName.text = @"车主电话";
        
        if([self.detailModel.MakeName length]<=0){
            
            cell.detailName.text = @"暂无车主电话";
            
        }else{
            cell.detailName.text = self.detailModel.CarOwnerTel;
        }
        
    }else if (indexPath.row == 4){
        cell.titleName.text = @"维修人";
        if([self.detailModel.RepairPerson length]<=0){
            
            cell.detailName.text = @"暂无维修人";
            
        }else{
            cell.detailName.text = self.detailModel.RepairPerson;
        }
        
    }else if (indexPath.row == 5){
        cell.titleName.text = @"维修次数";
        if([self.detailModel.RepairNum length]<=0){
            
            cell.detailName.text = @"暂无维修次数";
            
        }else{
            cell.detailName.text = self.detailModel.RepairNum;
        }
        
    }else if (indexPath.row == 6){
        cell.titleName.text = @"维修金额";
        if([self.detailModel.SumMoney length]<=0){
            
            cell.detailName.text = @"暂无维修金额";
            
        }else{
            cell.detailName.text = self.detailModel.SumMoney;        }
        
        
        
    }else if (indexPath.row == 7){
        cell.titleName.text = @"欠款";
        if([self.detailModel.Arrears length]<=0){
            
            cell.detailName.text = @"暂无欠款记录";
            
        }else{
            cell.detailName.text = self.detailModel.Arrears;
        }
        
        
    }else if (indexPath.row == 8){
        if([self.detailModel.RepairTime length]<=0){
            cell.detailName.text = @"暂无最近维修时间";
            
        }else{
            cell.detailName.text = self.detailModel.RepairTime;
            
        }
        cell.titleName.text = @"最近维修时间";
    }else if (indexPath.row == 9){
        cell.titleName.text = @"推荐人";
        NSLog(@"%@",self.detailModel.RecommendName);
        if([self.detailModel.RecommendName length]<=0){
            cell.detailName.text = @"暂无推荐人";
            
        }else{
            cell.detailName.text = self.detailModel.RecommendName;
            
        }
        
    }else if (indexPath.row == 10){
        cell.titleName.text = @"车辆型号";
        
        if([self.detailModel.TypeName length]<=0){
            cell.detailName.text = @"暂无车辆型号";
            
        }else{
            cell.detailName.text = self.detailModel.TypeName;
        }
        
    }
    
    return cell;
}


@end
